package com.ys.malini.dao.impl;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.ys.malini.dao.IImagesDao;
import com.ys.malini.model.TImages;


@SuppressWarnings("unchecked")
public class ImagesDaoImpl extends HibernateDaoSupport implements IImagesDao {

	public ImagesDaoImpl() {
		
	}

	public TImages saveImages(TImages images) {
		getHibernateTemplate().save(images);
		return images;
	}

	public void deleteImages(String commodityId) {
		getSession().getTransaction().begin();
		String hql ="DELETE TImages WHERE 1=1 and productId ="+commodityId;
		Query query = getSession().createQuery(hql);		
		query.executeUpdate();
		getSession().getTransaction().commit();
	}
}
